<template>
  <div class="shop-header-com">
    <div v-show="showDelete" class="list-item-delete">
      <span class="pull_left">{{ item.text }}</span>
      <span class="pull_right" @click.stop="deleteCurItem(item, index)"
        >删除</span
      >
    </div>
    <div v-if="item.stylesType == 0" class="styleOne">
      <img :src="item.imgUrl" alt="" class="bg" />

      <div
        class="line"
        :style="{
          backgroundColor:
            item.backgroundColor == null ? 'transparent' : item.backgroundColor
        }"
        style="position:relative;margin-top: -4px;"
      >
        <img
          :src="
            $store.state.qiniu + $store.state.app_cover + $store.state.imgRotate
          "
          alt=""
          class="logo"
        />
        <span
          :style="{ color: item.color == null ? 'transparent' : item.color }"
          style="margin-left:78px;"
          >{{ $store.state.app_name }}</span
        >
        <span>•••</span>
      </div>
    </div>
    <div
      v-if="item.stylesType == 1"
      class="styleTwo"
      :style="{
        backgroundColor:
          item.backgroundColor == null ? 'transparent' : item.backgroundColor
      }"
    >
      <img
        :src="
          $store.state.qiniu + $store.state.app_cover + $store.state.imgRotate
        "
        alt=""
      />
      <span
        :style="{ color: item.color == null ? 'transparent' : item.color }"
        >{{ $store.state.app_name }}</span
      >
    </div>
  </div>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {}
    },
    index: {
      type: Number,
      default: -1
    },
    showDelete: {
      type: Boolean,
      default: false
    }
  },
  methods: {
    deleteCurItem(e, i) {
      this.$emit("deleteCurItem", e, i);
    }
  }
};
</script>

<style lang="scss" scoped>
.shop-header-com {
  position: relative;
  .styleOne {
    .bg {
      width: 100%;
      height: 144px;
    }
    .logo {
      width: 56px;
      height: 56px;
      border-radius: 6px;
      position: absolute;
      margin-top: -26px;
      margin-left: 10px;
      border: 2px solid #ffffff;
    }
    .line {
      height: 38px;
      line-height: 38px;
      padding-right: 15px;
      background-color: #f1f1f1;
      span {
        font-size: 12px;
        color: #595961;
      }
      span:first-child {
        padding-left: 75px;
      }
      span:last-child {
        float: right;
      }
    }
  }
  .styleTwo {
    background-color: #fff;
    height: 50px;
    img {
      width: 30px;
      height: 30px;
      border-radius: 50px;
      float: left;
      margin: 10px;
    }
    span {
      float: left;
      line-height: 50px;
      height: 50px;
      font-size: 12px;
      color: #595961;
    }
  }
}
</style>
